<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>提车上线详细信息</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
    <script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div class="container" id="container">
        </br>
        </br>
        <div class="weui_cells weui_cells_form" style="margin-top:0px">
             <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">号牌号码：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spHPHM"></span>
                </div>
            </div>
             <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">VIN：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spVIN"></span>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">所有人：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spSYR"></span>
                </div>
            </div>
             <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">号牌种类：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spHPZL"></span>
                </div>
            </div>
             <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">车辆类型：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spCLLX"></span>
                </div>
            </div> 
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">初次登录时间：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spDLSJ"></span>
                </div>
            </div> 
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">检验次数：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spJYCS"></span>
                </div>
            </div> 
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">检验项目：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spJYXM"></span>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">引车员：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spYCY"></span>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">最后提车上线时间：</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <span id="spTJSJ"></span>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">检测线号</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="select" style="width: 200px" id="selectLineNum">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                    </select>
                </div>
            </div>
             <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label"></label></div>
            </div>
        </div> 
                </br>
        </br>
    <div class="mainbutton">
        <a class="weui_btn weui_btn_primary" href="javascript:;" id="btnTCSX" onclick="SaveTCSX()">提车上线</a>            
        </div>   
    </div>
    <div class="space"> 
    </div>
</body>
</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function(){
        GetTcsxInfo(api.pageParam.ID);
        GetJYXMInfo(api.pageParam.ID);
    };

    //得到检验项目详细信息
    function GetJYXMInfo(paraID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/GetVehicleJYXM_HN/'+paraID,
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.IsSuccess) {
                $("#spJYXM").html(ret.Data);
            }
        });
    }
   
    function GetTcsxInfo(paraID)
    {
        var vUrlRead = $api.getStorage('ServerUrlRead');
        api.ajax({
            url:vUrlRead + '/WcfServices/GetTCSXVehicleInfo_HN/'+paraID,
            method: 'post',
            contentType: "application/json",
        }, function(ret, err) {
            if (ret.IsSuccess) {
                $("#spHPZL").html(ret.Data.HPZL);
                $("#spCLLX").html(ret.Data.CLLX);
                $("#spSYR").html(ret.Data.SYR);
                $("#spYCY").html(ret.Data.YCY);
                $("#spTJSJ").html(ret.Data.TJSJ);
                $("#spHPHM").html(ret.Data.HPHM);
                $("#spVIN").html(ret.Data.VIN);
                $("#spDLSJ").html(ret.Data.DLSJ);
                $("#spJYCS").html(ret.Data.JYCS);
            }
        });
    }

    function SaveTCSX()
    {
        var vId = api.pageParam.ID;
        var vJCXDH = $("#selectLineNum").val();
        var vBHGX = $("#spFailItems").html();
        var vYCY = $api.getStorage('UserCHName');

        var vUrlWrite = $api.getStorage('ServerUrlWrite');

        $.ajax({
            type: 'Post',
            url: vUrlWrite + '/WcfServices/TcsxByYCY_HN',
            contentType: "application/json", //必须有
            async: false,
            dataType: "json", //表示返回值类型，不必须
                    //data: JSON.stringify({ 'UserName': 'admin', 'UserPwd': '123456' }),  //相当于 //data: "{'str1':'foovalue', 'str2':'barvalue'}",
            data: JSON.stringify({
                'PId': vId,
                'UserCHName': vYCY,
                'UserSFZH': '',
                'JCXDH': vJCXDH,
            }),
            success: function(ret) {
                //alert(JSON.stringify(ret));
                if (ret.TcsxByYCY_HNResult) {
                    if(ret.TcsxByYCY_HNResult.IsSuccess)
                    {
                        api.alert({
                            title: '提示',
                            msg: ret.TcsxByYCY_HNResult.Message,
                        }, function(ret, err){
                            RefreshTCSXHome();  
                        });
                    }
                    else
                    {
                        api.alert({
                            title: '错误',
                            msg: ret.TcsxByYCY_HNResult.Message,
                        }, function(ret, err){
                                
                        });
                    }
                } else {
                    }
            },
            error: function(data, status, e) {
                alert(e);
            }
        });
    }

    function RefreshTCSXHome()
    {
        api.openWin({
            name: 'win_tcsxhome',
            url: 'win_tcsxhome.html',
            bounces: false,
            delay: 200,
            reload:true,
        });

        api.closeWin({
            name: 'win_tcsxinfo',
            url: 'win_tcsxinfo.html',
        });
    }
</script>